/**
 * 抽屉详情 hooks
 * @Author: linzy
 * @Date: 2022-08-29
 * @function useDrawer
 * @returns [DrawerDetail, drawerDetailProps, drawerVisibleSet]
 * @example
const detailItems = [
  {
    title: "基础信息", children: [
      { label: 'xxx', name: 'xxx' },
      { label: '时间', name: 'xxx', type: 'datetime' },
      { label: '图片墙', name: 'xxx', type: 'images' },
      { label: '价格', name: 'xxx', type: 'money' },
    ],
  }
]
const [DrawerDetail, drawerDetailProps, drawerVisibleSet] = useDrawerDetail({
  detail: medalDetail,
  detailItems,
})
<DrawerDetail {...drawerDetailProps} />
*/
import { useDrawer, useDetail } from "@/hooks";
import styles from "./css/useDrawerDetail.less";
import { setOutAttrs, setDefaultAttrs, setAlias } from "@/hooks/tools";

export default (props = {}) => {
  const { detailItems, detail, ...restProps } = props;
  const Detail = useDetail({
    detail,
    detailItems,
    descriptionsProps: {
      bordered: false,
      column: 1
    }
  });
  const [Drawer, DrawerProps, visibleSet] = useDrawer({
    ...restProps,
    children: <Detail />,
    className: styles.detailBox
  });
  return [Drawer, DrawerProps, visibleSet];
};
